Skip to content

Run Map: renew the Battle.net sign-in and start the game in the user's own registry view - #1629

Merged
Frotty merged 2 commits into
masterfrom
battlenet-outside-registry
Nov 17, 2026
Merged

Frotty merged 2 commits into
masterfrom
battlenet-outside-registry

Conversation

@Frotty

@Frotty Frotty commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Problem

Run Map renews the -editor sign-in from the Battle.net app by copying the one-time WEB_TOKEN to EDITOR_TOKEN, then starts the game. Battle.net, the renewal and the game hand the sign-in to each other through HKCU.

A process started from a packaged (MSIX) app, such as the Claude desktop app or a VS Code started from a terminal inside it, reads and writes HKCU through the package's private copy, and so does everything it starts. Wurst's reg.exe calls, the Battle.net it asked to launch and the game it started could each see a different registry from the rest of the machine. Tokens got lost, and clients stopped at the login panel.

When Battle.net itself had been started from inside such an app, the renewal reported "Battle.net did not start Warcraft III. Check that it is signed in…". That message does not describe the cause.

Change

  • OutsideStart (new) starts a process through WMI (Win32_Process.Create), in the user's own context, on the same desktop. If WMI cannot start it, it falls back to ProcessBuilder.

  • The renewal now runs an embedded battlenet-token.ps1 outside Wurst's registry view, hidden. Wurst reads its outcome from a redirected output file:

    • it reads only complete lines;
    • it reads again after the script exits;
    • it removes the file only after the script has let it go.

    On cancellation it ends the script and closes any late client, as before.

  • This replaces the Java polling loop. The lock, the window watcher and releaseWhenSignedIn are kept.

  • New outcome token-not-visible: Battle.net started the game but no new token appeared. The user is told to quit Battle.net from its tray icon and start it from the Start menu.

  • Run Map starts the game through OutsideStart on Windows, with the same working directory as before. BattleNetLaunchWindows.handOff now takes a pid.

Validation

  • ./gradlew compileJava test --tests '*BattleNet*' --tests '*OutsideStart*' passes: BattleNetSignInTest 14, OutsideStartTest 3, BattleNetLaunchWindowsTest 1. The tests cover:
    • quoting;
    • a real WMI start of java.exe from a directory with spaces, checking that arguments with spaces, quotes and trailing backslashes, and the working directory, arrive intact;
    • UTF-16 output parsing, including a partial last line;
    • a script that ends between read and liveness check;
    • every outcome's message.
  • Other request tests pass (97).
  • The same renewal and WMI client start passed end to end from inside a Claude desktop session: the client signed in and loaded a test map.
  • Not done: a live Run Map from VS Code through this build.

…s own registry view

A process started from a packaged (MSIX) app, such as the Claude desktop app or a
VS Code started from a terminal inside it, reads and writes HKCU through the
package's private copy, and so does everything it starts, reg.exe included.
Battle.net, the renewal and the client hand the sign-in to each other through
HKCU, so a Wurst running in such a context read WEB_TOKEN, wrote EDITOR_TOKEN
and started the game where the rest of the machine never saw them: tokens got
lost and clients stopped at the login panel.

OutsideStart starts a process through WMI (Win32_Process.Create), which runs it
in the user's own context, in the same session and on the same desktop, and
returns its pid; startOrHere falls back to ProcessBuilder when WMI cannot.

The renewal now runs battlenet-token.ps1, a byte-identical copy of the
wc3-e2e-harness script, from a content-named temp copy, started outside and
hidden. Its output goes to a file (UTF-16 with BOM) that Wurst polls, counting
complete lines only. Outcomes map to messages: refreshed, no-token,
app-game-running, and the new token-not-visible, which tells the user that
Battle.net itself runs in a packaged app's private registry and must be
started from the Start menu. The Java polling loop and its reg.exe writes are
gone. The lock, the window watcher, cancellation (which ends the script, then
closes a late client) and releaseWhenSignedIn stay; the latter reads
EDITOR_TOKEN once after the renewal and falls back to its 120 s timeout.

Run Map starts the client outside too (normal window, Wurst's working
directory) and hands its pid to BattleNetLaunchWindows, falling back to the
direct start with a log line.

Mirrors Frotty/wc3-e2e-harness#62.
The script ends right after its result line, but could still hold the file
open when Run Map deleted it, leaving it to deleteOnExit in a language server
that runs for days. Wait up to 5 s for the script to exit first, as the
harness does (Frotty/wc3-e2e-harness#62).
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T21:38:26.874269Z 9247128 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Frotty
Frotty merged commit eea7938 into master Nov 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant